﻿//
//  LiveManager.h
//  websocketserver
//  切勿外传，自己使用，完善bug，反馈给作者
//  Created by cl.zhan on 17/6/3.
//  email:zhanchonglongba@126.com/690759587
//
//

#ifndef LIVEMANAGER_H_H_
#define LIVEMANAGER_H_H_

#include <QtNetwork>
#include <QWebSocket>
#include<QMutex>
#include "base/SimpleEvent.h"
#include "base/SimpleThread.h"
#include "IRtspReadManager.h"
#include "EventListQueue.h"


class WebSocketManager;
//class IRtspReadManager;

class LiveManager:public QObject, base::SimpleThread,public PlayCallback
{
    Q_OBJECT
public:
    LiveManager(WebSocketManager * _websocketmanager);
    ~LiveManager();

    int  DoStartPullStream(QString & pull_url,int num);
    int  DoStopPullStream(QString & pull_url);

    //线程
    virtual void Run();

    void OnReadErrorEvent(void * rtsp_this, std::string pull_url);

private:
    WebSocketManager * _manager;
    QMutex	cs_live_;

    QList<IRtspReadManager*> mrtsps;
    int pull_channel_id;  //累增的

    base::SimpleEvent time_event;

    EventListQueue * event_queue;

};

#endif // LIVEMANAGER_H_H_
